package com.crm.controller;

import com.crm.pojo.common.PageResult;
import com.crm.pojo.common.Result;
import com.crm.pojo.dto.UserDto;
import com.crm.service.ClueService;
import com.crm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 转派管理
 */

@RestController
public class TransferController {

    @Autowired
    private UserService userService;
    @Autowired
    private ClueService clueService;

    /**
     * 转派管理分页查询
     * @param dto
     * @return
     */
    @GetMapping("/transfer/list")
    public PageResult list(UserDto dto){
        return userService.transferList(dto);
    }

    /**
     * 转派处理
     * @return
     */
    @PutMapping("/transfer/assignment/{clueOrBusiness}/{oldId}/{newId}")
    public Result transfer(@PathVariable Long clueOrBusiness, @PathVariable Long oldId, @PathVariable Long newId){
        clueService.transfer(clueOrBusiness,oldId,newId);
        return Result.success();
    }

}
